package com.bigfish.gbs.exception;

import com.bigfish.gbs.enums.ResultEnum;

/**
 * 自定义异常类，在service层抛出异常，传入对应的枚举类，由ExceptionHandler处理异常
 * Created by Joycessh
 * 11/25/18 9:46 PM
 */
public class MyException extends RuntimeException {

    private ResultEnum resultEnum;
    private Integer code;

    public MyException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
        this.resultEnum = resultEnum;
    }

    public ResultEnum getResultEnum() {
        return resultEnum;
    }

    public void setResultEnum(ResultEnum resultEnum) {
        this.resultEnum = resultEnum;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}